
//
//  PDetailProductNumCell.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/15.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "PDetailProductNumCell.h"
#import "CommonMacro.h"
#import "PDeProNumModel.h"
@implementation PDetailProductNumCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubviews];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self valueWithSubview];
}
- (void)initSubviews
{
    CGFloat labelH = 20;
    
    //0.商品参数
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 3, SCREEN_WIDTH*0.3, 20)];
    self.titleLabel.text = @"商品参数：";
    self.titleLabel.textColor = UIColorWithRGBA(148, 148, 148, 1);
//    self.titleLabel.backgroundColor = [UIColor redColor];
    [self addSubview:self.titleLabel ];
    
    //1.商品参数 具体内容
    self.productNum = [[UILabel alloc] initWithFrame:CGRectMake(5, 23, SCREEN_WIDTH-10, 60)];
//    self.productNum.text = @"商品参数";
    self.productNum.textColor = UIColorWithRGBA(148, 148, 148, 1);
    self.productNum.font = [UIFont fontWithName:nil size:13];
    self.productNum.numberOfLines = 0;
//    [self.productNum sizeToFit];
//    self.productNum.backgroundColor = [UIColor redColor];
    [self addSubview:self.productNum];
    
    //2.储存方法
    self.methord = [[UILabel alloc] initWithFrame:CGRectMake(self.productNum.frame.origin.x, self.productNum.frame.origin.y+self.productNum.frame.size.height, self.productNum.frame.size.width, labelH)];
    self.methord.numberOfLines = 0;
    self.methord.font = [UIFont fontWithName:nil size:13];
    self.methord.textColor = UIColorWithRGBA(148, 148, 148, 1);
//    self.methord.backgroundColor = [UIColor grayColor];
    [self addSubview:self.methord];
    
    //3.保质期
    self.shelfLif = [[UILabel alloc] initWithFrame:CGRectMake(self.methord.frame.origin.x, self.methord.frame.origin.y+self.methord.frame.size.height, self.methord.frame.size.width*0.45, labelH)];
    self.shelfLif.font = [UIFont fontWithName:nil size:13];
    self.shelfLif.textColor = UIColorWithRGBA(148, 148, 148, 1);
//    self.shelfLif.backgroundColor = [UIColor greenColor];
    [self addSubview:self.shelfLif];
    
    //4.规格
    self.specification = [[UILabel alloc] initWithFrame:CGRectMake(self.shelfLif.frame.size.width, self.shelfLif.frame.origin.y, self.productNum.frame.size.width*0.55, labelH)];
    self.specification.font = [UIFont fontWithName:nil size:13];
    self.specification.textColor = UIColorWithRGBA(148, 148, 148, 1);
//    self.specification.backgroundColor = [UIColor redColor];
    [self addSubview:self.specification];
    
    //5.包装种类
    self.typeOfPackage = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.origin.x, self.shelfLif.frame.size.height+self.shelfLif.frame.origin.y, self.shelfLif.frame.size.width, labelH)];
    self.typeOfPackage.font = [UIFont fontWithName:nil size:13];
    self.typeOfPackage.textColor = UIColorWithRGBA(148, 148, 148, 1);
//    self.typeOfPackage.backgroundColor = [UIColor cyanColor];
    [self addSubview:self.typeOfPackage];
    
    //6.试用年龄
    self.probationAge = [[UILabel alloc] initWithFrame:CGRectMake(self.typeOfPackage.frame.size.width, self.specification.frame.origin.y+self.specification.frame.size.height, self.specification.frame.size.width, labelH)];
    self.probationAge.font = [UIFont fontWithName:nil size:13];
    self.probationAge.textColor = UIColorWithRGBA(148, 148, 148, 1);
//    self.probationAge.backgroundColor = [UIColor blueColor];
    [self addSubview:self.probationAge];
    
}

- (void)valueWithSubview
{
    self.productNum.text = [NSString stringWithFormat:@"配料表：%@",self.proDetailProNumModel.productNum];
    self.shelfLif.text = [NSString stringWithFormat:@"保质期：%@",self.proDetailProNumModel.shelfLif];
    self.specification.text = [NSString stringWithFormat:@"规格：%@",self.proDetailProNumModel.specification];
    self.typeOfPackage.text = [NSString stringWithFormat:@"包装种类：%@",self.proDetailProNumModel.typeOfPackage];
    self.probationAge.text = [NSString stringWithFormat:@"试用年龄：%@",self.proDetailProNumModel.probationAge];
    self.methord.text = [NSString stringWithFormat:@"存储方法：%@",self.proDetailProNumModel.methord];
}
@end
